package ui.activity.poscontrol;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.widget.TextView;

import net.ck.hzq.R;
import net.ck.hzq.TobuyApplication;

import java.util.ArrayList;
import java.util.List;

import base.BaseAct;
import base.BaseFra;
import butterknife.BindView;
import event.NetErrorEvent;
import ui.adapter.FragAdp;
import ui.fragment.PosControl.PushBackHisToryRecordMyFra;
import ui.fragment.PosControl.PushBackHisToryRecordOtherFra;
import util.SysUtils;
import widget.tab.TabPageIndicator;


/**
 * Created by fangjunsong on 19/3/19
 * 我的终端列表页面专用
 */

public class PushBackHistoryRecordAct extends BaseAct {


    @BindView(R.id.my_tabs)
    TabPageIndicator myTab;
    @BindView(R.id.my_vp)
    ViewPager vp;
    public List<BaseFra> fragments;
    List<String> titles = new ArrayList<>();
    @BindView(R.id.needsx)
    TextView needsx;//右上角更多按钮
    @Override
    protected void setRoot() {
//        setTitleBar("#0099E6");
        setContentView(R.layout.activity_order);

    }
    @Override
    protected void setup() {
        setToolBar(getResources().getString(R.string.lang_pushback_title3), "");
    }
    @Override
    protected void init(@Nullable Bundle savedInstanceState) {
        fragments = new ArrayList<>();
        titles.add(getResources().getString(R.string.lang_pushback_item1));
        titles.add(getResources().getString(R.string.lang_pushback_item2));
        fragments.add(new PushBackHisToryRecordMyFra());
        fragments.add(new PushBackHisToryRecordOtherFra());
        vp.setPageMargin(SysUtils.dip2px(this, 0f));
        vp.setOffscreenPageLimit(titles.size());
        vp.setAdapter(new FragAdp(this.getSupportFragmentManager(), titles, fragments));
        myTab.setViewPager(vp);
        setTabPagerIndicator();
    }
    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
    public void onNetErrorEvent(NetErrorEvent event) {
        super.onNetErrorEvent(event);
    }

    @Override
    protected void onNetError(NetErrorEvent event) {
    }
    @Override
    protected void onStop() {
        super.onStop();
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
    /**
     * 设置标题栏
     */
    private void setTabPagerIndicator() {
        myTab.setIndicatorMode(TabPageIndicator.IndicatorMode.MODE_NOWEIGHT_EXPAND_SAME);// 设置模式，一定要先设置模式
//        myTab.setDividerColor(Color.parseColor("#0099E6"));// 设置分割线的颜色
        myTab.setDividerPadding(SysUtils.dip2px(TobuyApplication.getInstance(), 0));
        myTab.setIndicatorColor(Color.parseColor("#0099E6"));// 设置底部导航线的颜色
        myTab.setTextColorSelected(Color.parseColor("#0099E6"));// 设置tab标题选中的颜色
        myTab.setTextColor(Color.parseColor("#333333"));// 设置tab标题未被选中的颜色
        myTab.setTextSize((int) SysUtils.sp2px(TobuyApplication.getInstance(), 14));// 设置字体大小
    }

}
